#!/bin/sh
set -e

# 获取当前目录
current_dir=$(cd `dirname $0`; pwd)
echo $current_dir

CLEAR_BUILD_CACHE="ON" # 是否关闭缓存清理

BUILD_DIR=${current_dir}/build
OUTPUT_DIR=${current_dir}/bin

mkdir -p $BUILD_DIR

pushd $BUILD_DIR # 添加并切换路径

cmake  ..
rm -rf ${OUTPUT_DIR}/*
cmake  --build . -- "-j${HOST_NCPUS}" 

popd 

# 清除build缓存
if [ $CLEAR_BUILD_CACHE = "ON" ]; then
    rm -rf ${BUILD_DIR}
fi

